<?php
//查询数据 0,2 2条数据
$redis = new Redis();
$redis->connect('127.0.0.1', 6379);

$info = $redis->lRange('user',0,2);
echo '<pre>';
var_dump($info);
echo '</pre>';
?>

<html>
    <header>
        <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
        <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
        <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
        <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
        <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    </header>
    <body>
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2" style="margin-top: 10px; margin-bottom: 10px;">
                <button class="btn btn-primary pull-right" data-toggle="modal" data-target="#myModal">新增用户</button>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-2"></div>
            <div class="col-lg-8">
                <table class="table table-bordered">
                    <thead>
                    <tr>
                        <th>用户名</th>
                        <th>年龄</th>
                        <th>性别</th>
                        <th>爱好</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td>Tanmay</td>
                        <td>Bangalore</td>
                        <td>560001</td>
                        <td>560001</td>
                        <td>
                            <span class="btn btn-primary">编辑</span>
                            <span class="btn btn-danger">删除</span>
                        </td>
                    </tr>
                    <tr>
                        <td>Sachin</td>
                        <td>Mumbai</td>
                        <td>400003</td>
                        <td>400003</td>
                        <td>
                            <span class="btn btn-primary">编辑</span>
                            <span class="btn btn-danger">删除</span>
                        </td>
                    </tr>
                    <tr>
                        <td>Uma</td>
                        <td>Pune</td>
                        <td>411027</td>
                        <td>411027</td>
                        <td>
                            <span class="btn btn-primary">编辑</span>
                            <span class="btn btn-danger">删除</span>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div class="col-lg-2"></div>
        </div>

        <!-- 模态框（Modal） -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="myModalLabel">新增用户</h4>
                    </div>
                    <form action="user.php" class="form-horizontal" method="post" role="form">
                        <div class="modal-body">
                                <div class="form-group">
                                    <label for="firstname" class="col-sm-2 control-label">用户名</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="firstname" name="username" placeholder="请输入用户名">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="lastname" class="col-sm-2 control-label">年龄</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" id="lastname" name="age" placeholder="请输入年龄">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="lastname" class="col-sm-2 control-label">性别</label>
                                    <div class="col-sm-10">
                                        <input type="radio" value="man" name="sex"> 男
                                        <input type="radio" value="woman" name="sex"> 女
                                    </div>
                                </div>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                            <button type="submit" class="btn btn-primary">提交更改</button>
                        </div>
                    </form>
                </div><!-- /.modal-content -->
            </div><!-- /.modal -->
        </div>
    </body>
</html>